{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Overwatch League Statistics"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.cm as cm\n",
    "import matplotlib.colors as colors\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(103232, 10)"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_csv(\"phs_2019_playoffs.csv\")\n",
    "df.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['All Damage Done', 'Assists', 'Average Time Alive',\n",
       "       'Barrier Damage Done', 'Damage - Quick Melee', 'Damage Blocked',\n",
       "       'Damage Done', 'Damage Taken', 'Deaths', 'Eliminations',\n",
       "       'Environmental Deaths', 'Final Blows', 'Healing Done',\n",
       "       'Hero Damage Done', 'Melee Final Blows',\n",
       "       'Melee Percentage of Final Blows', 'Multikills', 'Objective Kills',\n",
       "       'Objective Time', 'Shots Fired', 'Time Alive',\n",
       "       'Time Building Ultimate', 'Time Elapsed per Ultimate Earned',\n",
       "       'Time Holding Ultimate', 'Time Played',\n",
       "       'Ultimates Earned - Fractional', 'Ultimates Used',\n",
       "       'Weapon Accuracy', 'Critical Hit Accuracy', 'Critical Hit Kills',\n",
       "       'Critical Hits', 'Damage - Boosters', 'Damage - Micro Missiles',\n",
       "       'Damage - Pistol', 'Damage - Weapon', 'Eliminations per Life',\n",
       "       'Healing Received', 'Mech Deaths', 'Mechs Called',\n",
       "       'Quick Melee Accuracy', 'Quick Melee Hits', 'Quick Melee Ticks',\n",
       "       'Self-Destructs', 'Shots Hit', 'Shots Missed', 'Time Hacked',\n",
       "       'Accretion Kills', 'Accretion Stuns', 'Damage - Accretion',\n",
       "       'Damage - Hyperspheres', 'Damage Absorbed',\n",
       "       'Gravitic Flux Damage Done', 'Gravitic Flux Kills',\n",
       "       'Hyperspheres Direct Hits', 'Environmental Kills',\n",
       "       'Offensive Assists', 'Solo Kills', 'Ability Damage Done',\n",
       "       'Damage - Rising Uppercut', 'Damage - Rocket Punch',\n",
       "       'Damage - Seismic Slam', 'Shields Created',\n",
       "       'Concussion Mine Kills', 'Damage - Concussion Mine',\n",
       "       'Damage - RIP-Tire', 'Damage - Steel Trap', 'Enemies Trapped',\n",
       "       'Frag Launcher Direct Hits', 'RIP-Tire Efficiency',\n",
       "       'RIP-Tire Kills', 'Barrage Efficiency', 'Barrage Kills',\n",
       "       'Damage - Barrage', 'Direct Hit Accuracy', 'Rocket Barrages',\n",
       "       'Rocket Direct Hits', 'of Rockets Fired', 'Defensive Assists',\n",
       "       'Amped Speed Activations', 'Speed Song Time Elapsed',\n",
       "       'Biotic Orb Damage Efficiency', 'Biotic Orb Healing Efficiency',\n",
       "       'Biotic Orb Maximum Damage', 'Biotic Orb Maximum Healing',\n",
       "       'Coalescence Healing', 'Coalescence Kills',\n",
       "       'Coalesence - Damage per Use', 'Coalesence - Healing per Use',\n",
       "       'Damage - Biotic Orb', 'Damage - Coalescence',\n",
       "       'Healing - Biotic Orb', 'Healing - Coalescence',\n",
       "       'Healing - Secondary Fire', 'Secondary Fire Accuracy',\n",
       "       'Secondary Fire Hits', 'Secondary Fire Ticks', 'Self Healing',\n",
       "       'Self Healing Percent of Damage Taken', 'EMP Efficiency',\n",
       "       \"Enemies EMP'd\", 'Enemies Hacked',\n",
       "       'Average Players per Teleporter', 'Damage - Sentry Turret',\n",
       "       'Damage - Weapon Primary', 'Damage - Weapon Secondary',\n",
       "       'Photon Projector Kills', 'Players Teleported',\n",
       "       'Primary Fire Accuracy', 'Primary Fire Average Level',\n",
       "       'Primary Fire Hits', 'Primary Fire Hits Hits - Level',\n",
       "       'Primary Fire Ticks', 'Secondary Direct Hits',\n",
       "       'Sentry Turret Kills', 'Teleporter Uptime', 'Teleporters Placed',\n",
       "       'Amplification Matrix Assists', 'Amplification Matrix Casts',\n",
       "       'Amplification Matrix Efficiency',\n",
       "       'Biotic Launcher Healing Explosions',\n",
       "       'Biotic Launcher Healing Shots', 'Damage Amplified',\n",
       "       'Damage Prevented', 'Healing - Biotic Launcher',\n",
       "       'Healing - Regenerative Burst', 'Healing Accuracy',\n",
       "       'Immortality Field Deaths Prevented', 'Blaster Kills',\n",
       "       'Damage - Weapon Pistol', 'Healing - Weapon',\n",
       "       'Healing - Weapon Valkyrie', 'Players Resurrected',\n",
       "       'Players Saved', 'Valkyrie Healing Efficiency', 'Players Halted',\n",
       "       'Supercharger Assists', 'Supercharger Efficiency',\n",
       "       'Adaptive Shield Uses', 'Air Uptime', 'Air Uptime Percentage',\n",
       "       'Damage - Grappling Claw', 'Damage - Minefield',\n",
       "       'Damage - Piledriver', 'Damage Taken - Adaptive Shield',\n",
       "       'Damage Taken - Ball', 'Damage Taken - Tank',\n",
       "       'Grappling Claw Impacts', 'Grappling Claw Kills',\n",
       "       'Grappling Claw Uses', 'Piledriver Kills', 'Piledriver Uses',\n",
       "       'Players Knocked Back', 'Roll Uptime', 'Roll Uptime Percentage',\n",
       "       'Roll Uses', 'Shielding - Adaptive Shield', 'Turrets Destroyed',\n",
       "       'Amped Heal Activations', 'Heal Song Time Elapsed',\n",
       "       'Healing - Healing Boost', 'Healing - Healing Boost Amped',\n",
       "       'Soundwave Kills', 'Damage - Meteor Strike',\n",
       "       'Meteor Strike Efficiency', 'Meteor Strike Kills',\n",
       "       'Teleporter Pads Destroyed', 'Damage - Call Mech',\n",
       "       'Average Energy', 'Energy Maximum', 'Lifetime Energy Accumulation',\n",
       "       'Projected Barrier Damage Blocked', 'Projected Barriers Applied',\n",
       "       'Match Blinks Used', 'Biotic Grenade Kills',\n",
       "       'Damage - Biotic Grenade', 'Damage - Weapon Scoped',\n",
       "       'Enemies Slept', 'Healing - Biotic Grenade',\n",
       "       'Healing - Weapon Scoped', 'Healing Amplified',\n",
       "       'Nano Boost Assists', 'Nano Boost Efficiency',\n",
       "       'Nano Boosts Applied', 'Scoped Accuracy', 'Scoped Hits',\n",
       "       'Scoped Shots', 'Sleep Dart Hits', 'Sleep Dart Shots',\n",
       "       'Sleep Dart Success Rate', 'Unscoped Accuracy', 'Unscoped Hits',\n",
       "       'Unscoped Shots', 'Damage - Jump Pack',\n",
       "       'Damage - Primal Rage Leap', 'Damage - Primal Rage Melee',\n",
       "       'Damage - Primal Rage Total', 'Jump Pack Kills',\n",
       "       'Primal Rage Melee Accuracy', 'Primal Rage Melee Efficiency',\n",
       "       'Primal Rage Melee Hits', 'Primal Rage Melee Hits - Multiple',\n",
       "       'Primal Rage Melee Ticks', 'Tesla Cannon Accuracy',\n",
       "       'Tesla Cannon Efficiency', 'Tesla Cannon Hits',\n",
       "       'Tesla Cannon Hits - Multiple', 'Tesla Cannon Ticks',\n",
       "       'Weapon Kills', 'Sound Barrier Casts', 'Sound Barrier Efficiency',\n",
       "       'Sound Barriers Provided', 'Damage - Self Destruct',\n",
       "       'Self Destruct Efficiency', 'Self-Destruct Kills',\n",
       "       'Damage - Death Blossom', 'Death Blossom Efficiency',\n",
       "       'Death Blossom Kills', 'Death Blossoms', 'Damage - Total Mayhem',\n",
       "       'Total Mayhem Kills', 'Recon Assists', 'Health Recovered',\n",
       "       'Recalls Used', 'Damage - Venom Mine', 'Infra-Sight Efficiency',\n",
       "       'Infra-sight Uptime', 'Scoped Critical Hit Accuracy',\n",
       "       'Scoped Critical Hit Kills', 'Scoped Critical Hits',\n",
       "       'Venom Mine Kills', 'Healing - Immortality Field',\n",
       "       'High Energy Kills', 'Bob Gun Damage', 'Coach Gun Kills',\n",
       "       'Damage - Bob', 'Damage - Bob Charge', 'Damage - Coach Gun',\n",
       "       'Damage - Dynamite', 'Dynamite Kills', 'Damage - EMP',\n",
       "       'Melee Kills', 'Blizzard Efficiency', 'Blizzard Kills',\n",
       "       'Damage - Blizzard', 'Enemies Frozen', 'Freeze Spray Damage',\n",
       "       'Icicle Damage', 'Successful Freezes', 'Total Time Frozen',\n",
       "       'Damage - Flashbang', 'Fan the Hammer Kills', 'Damage - Deadeye',\n",
       "       'Deadeye Efficiency', 'Deadeye Kills', 'Primal Rage Efficiency',\n",
       "       'Primal Rage Kills', 'Damage - Weapon Sentry',\n",
       "       'Damage - Weapon Recon', 'Sentry Kills', 'Ultimates Negated',\n",
       "       'Minefield Kills', 'Damage - Charge',\n",
       "       'Rocket Hammer Melee Accuracy',\n",
       "       'Rocket Hammer Melee Average Targets', 'Rocket Hammer Melee Hits',\n",
       "       'Rocket Hammer Melee Hits - Multiple', 'Rocket Hammer Melee Ticks',\n",
       "       'Damage - Pulse Bomb', 'Pulse Bomb Attach Rate',\n",
       "       'Pulse Bomb Efficiency', 'Pulse Bomb Kills',\n",
       "       'Pulse Bombs Attached', 'Recon Kills', 'Damage - Dragonstrike',\n",
       "       'Damage - Sonic', 'Damage - Storm Arrows', 'Storm Arrow Kills',\n",
       "       'Armor - Repair Pack', 'Armor Provided', 'Damage - Weapon Tank',\n",
       "       'Tank Efficiency', 'Tank Kills', 'Hooks Attempted',\n",
       "       'Damage - Chain Hook', 'Enemies Hooked', 'Hook Accuracy',\n",
       "       'Charge Kills', 'Damage - Fire Strike', 'Damage - Deflect',\n",
       "       'Damage - Dragonblade', 'Damage - Dragonblade Total',\n",
       "       'Damage - Swift Strike', 'Damage Reflected',\n",
       "       'Dragonblade Efficiency', 'Dragonblade Kills', 'Dragonblades',\n",
       "       'Biotic Field Healing Done', 'Biotic Fields Deployed',\n",
       "       'Damage - Helix Rockets', 'Helix Rocket Kills',\n",
       "       'Damage - Discord Orb', 'Damage - Weapon Charged',\n",
       "       'Discord Orb Time', 'Harmony Orb Time', 'Healing - Harmony Orb',\n",
       "       'Time Discorded', 'Healing - Transcendence',\n",
       "       'Transcendence Efficiency', 'Transcendence Healing',\n",
       "       'Transcendence Percent of Healing',\n",
       "       'Damage - Swift Strike Dragonblade', 'Deflection Kills',\n",
       "       'Fire Strike Kills', 'Bob Kills', 'Armor - Rally',\n",
       "       'Damage - Shield Bash', 'Healing - Inspire',\n",
       "       'Healing - Repair Pack', 'Inspire Uptime',\n",
       "       'Inspire Uptime Percentage', 'Rally Armor Efficiency'],\n",
       "      dtype=object)"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[\"map_type\"].unique()\n",
    "df[\"stat_name\"].unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "46"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "doomdf = df[df[\"hero\"] == \"Doomfist\"]\n",
    "doomdf.head()\n",
    "doomdf['stat_name'].nunique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>126</th>\n",
       "      <th>127</th>\n",
       "      <th>128</th>\n",
       "      <th>129</th>\n",
       "      <th>130</th>\n",
       "      <th>131</th>\n",
       "      <th>132</th>\n",
       "      <th>133</th>\n",
       "      <th>134</th>\n",
       "      <th>135</th>\n",
       "      <th>...</th>\n",
       "      <th>148</th>\n",
       "      <th>149</th>\n",
       "      <th>150</th>\n",
       "      <th>151</th>\n",
       "      <th>152</th>\n",
       "      <th>153</th>\n",
       "      <th>154</th>\n",
       "      <th>155</th>\n",
       "      <th>156</th>\n",
       "      <th>157</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>stat_name</td>\n",
       "      <td>All Damage Done</td>\n",
       "      <td>Assists</td>\n",
       "      <td>Average Time Alive</td>\n",
       "      <td>Barrier Damage Done</td>\n",
       "      <td>Damage - Quick Melee</td>\n",
       "      <td>Damage - Rising Uppercut</td>\n",
       "      <td>Damage - Rocket Punch</td>\n",
       "      <td>Damage - Seismic Slam</td>\n",
       "      <td>Damage - Weapon</td>\n",
       "      <td>Damage Taken</td>\n",
       "      <td>...</td>\n",
       "      <td>Shots Fired</td>\n",
       "      <td>Shots Hit</td>\n",
       "      <td>Shots Missed</td>\n",
       "      <td>Solo Kills</td>\n",
       "      <td>Time Alive</td>\n",
       "      <td>Time Building Ultimate</td>\n",
       "      <td>Time Elapsed per Ultimate Earned</td>\n",
       "      <td>Time Played</td>\n",
       "      <td>Ultimates Earned - Fractional</td>\n",
       "      <td>Weapon Accuracy</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>stat_amount</td>\n",
       "      <td>2233.31</td>\n",
       "      <td>2</td>\n",
       "      <td>22.473</td>\n",
       "      <td>539.508</td>\n",
       "      <td>42</td>\n",
       "      <td>247</td>\n",
       "      <td>356.536</td>\n",
       "      <td>357.834</td>\n",
       "      <td>650.864</td>\n",
       "      <td>1296.27</td>\n",
       "      <td>...</td>\n",
       "      <td>550</td>\n",
       "      <td>162</td>\n",
       "      <td>331</td>\n",
       "      <td>1</td>\n",
       "      <td>89.892</td>\n",
       "      <td>112.903</td>\n",
       "      <td>84.1586</td>\n",
       "      <td>112.907</td>\n",
       "      <td>1.34155</td>\n",
       "      <td>0.3286</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2 rows × 32 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                         126      127                 128  \\\n",
       "stat_name    All Damage Done  Assists  Average Time Alive   \n",
       "stat_amount          2233.31        2              22.473   \n",
       "\n",
       "                             129                   130  \\\n",
       "stat_name    Barrier Damage Done  Damage - Quick Melee   \n",
       "stat_amount              539.508                    42   \n",
       "\n",
       "                                  131                    132  \\\n",
       "stat_name    Damage - Rising Uppercut  Damage - Rocket Punch   \n",
       "stat_amount                       247                356.536   \n",
       "\n",
       "                               133              134           135  ...  \\\n",
       "stat_name    Damage - Seismic Slam  Damage - Weapon  Damage Taken  ...   \n",
       "stat_amount                357.834          650.864       1296.27  ...   \n",
       "\n",
       "                     148        149           150         151         152  \\\n",
       "stat_name    Shots Fired  Shots Hit  Shots Missed  Solo Kills  Time Alive   \n",
       "stat_amount          550        162           331           1      89.892   \n",
       "\n",
       "                                153                               154  \\\n",
       "stat_name    Time Building Ultimate  Time Elapsed per Ultimate Earned   \n",
       "stat_amount                 112.903                           84.1586   \n",
       "\n",
       "                     155                            156              157  \n",
       "stat_name    Time Played  Ultimates Earned - Fractional  Weapon Accuracy  \n",
       "stat_amount      112.907                        1.34155           0.3286  \n",
       "\n",
       "[2 rows x 32 columns]"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "doomdf2= doomdf[[\"stat_name\",\"stat_amount\"]].transpose()\n",
    "doomdf2.iloc[0:2,1:33]"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
